<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/common/taglibs.jsp"%>
<html>
<head>
<title>新建合同</title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8">
<link href="${ctx }/CSS/style.css" rel="stylesheet" type="text/css">
</head>
<body>
<table width="584" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="27" colspan="6" bgcolor="#EEEEEE" class="tableBorder_gray">
    &nbsp;<span  class="word_deepgrey"> 当前位置：商品销售> </span>新建合同 &gt;&gt;&gt;</td>
  </tr>
    <tr><td valign="top" height="83">
    	<form action="${ctx }/contactAction.do" method="post">
    	<input type="hidden" name="method" value="save">
    	<input type="hidden" name="orderNum" value="0">
	    <table width="98%" height="112"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#F2F2F2">
	    	<c:if test="${not empty message }">
	    	<tr>
	    		<td width="274" colspan="2" style="color:#F00;">${message }</td>
	    	</tr>
	    	</c:if>
	    	<tr>
	    		<td width="137">合同名</td>
	    		<td width="137"><input type="text" name="title" value='<c:out value="${title }" default="请输入合同名称"></c:out>' /></td>
	    	</tr>
	    	<tr>
	    		<td width="137">合同内容</td>
	    		<td width="137"><textarea name="content" ><c:out value="${title }" default="请输入合同内容"></c:out></textarea></td>
	    	</tr>
	    	<tr>
	    		<td width="137">客户</td>
	    		<td width="137">
					<select name="customerid">
						<c:forEach items="${customers }" var="customer">
							<option value="${customer.customerID }">${customer.customerName }</option>
						</c:forEach>
					</select>	
				</td>
	    	</tr>
	    	<tr>
	    		<td width="137" colspan="2"><a href="javascript:void(0);" id="addSaleOrderBtn">+添加销售订单</a></td>
	    	</tr>
	    	<tr id="copyOrder" style="display:none;">
	    		<td colspan="2">
	    			<table>
	    				<tr>
	    					<td>商品</td><td>售价</td><td>数量</td><td>出库时间</td><td>确认人</td>
	    				</tr>
	    				<tr>
	    					<td>
								<select name="goodsId_index_">
								<c:forEach items="${goodses }" var="goods">
									<option value="${goods.goodsId }">${goods.goodsName }</option>
								</c:forEach>
								</select>
							</td>
							<td><input type="text" name="price_index_" value="1"></td>
							<td><input type="text" name="num_index_" value="1"></td>
							<td><input type="text" name="outStoreTime_index_" value="2013-11-11"></td>
							<td>
								<select name="inspectorid_index_">
								<c:forEach items="${users }" var="user">
									<option value="${user.userID }">${user.loginName }</option>
								</c:forEach>
								</select>
							</td>
	    				</tr>
	    			</table>
	    		</td>
	    	</tr>
	    	<tr id="saveBtn">
	    		<td><input type="submit" value="保存" /></td>
	    		<td><input type="reset" value="重置" /></td>
	    	</tr>
		</table>
		</form>
	</td></tr>
</table>
<script type="text/javascript" src="${ctx }/js/jquery-1.7.2.min.js"></script>
<script type="text/javascript">
	$(document).ready(function() {
		$("#addSaleOrderBtn").click(function() {
			var orderNum = parseInt($("input[name='orderNum']").val());
			$("input[name='orderNum']").val(orderNum + 1);
			var newOrder = $("#copyOrder").clone(true);
			newOrder.html(newOrder.html().replace(/_index_/gm, orderNum));
			newOrder.show().insertBefore($("#saveBtn"));
		});
	});
</script>
</body>
</html>
